package com.mit.web.business.proxy
{
	import com.mit.web.business.remote.BaseService;
	import com.mit.web.business.remote.IInvokeResponder;
	import com.mit.web.config.Constants;
	import com.mit.web.config.DisplayConfiguration;
	import com.mit.web.vo.sale.CustomerVO;
	
	public class SaleProxy extends BaseService
	{
		private static var me:SaleProxy;

		
		public function SaleProxy()
		{
			super(Constants.REMOTE_OBJECT_SALE);
			if(me != null)
				throw new Error("Only one instance of this class is allowed, use getInstance() insteadof the constructor.");

		}
		
		public static function getInstance():SaleProxy{
			if(me == null)
				me = new SaleProxy();
			return me;
		} 
		
		public function saveCustomer(customer:CustomerVO):IInvokeResponder{
			return invoke("saveCustomer", customer);
		}
		
		public function getPagedCustomers(pageNo:int, searchKey:String = null):IInvokeResponder{
			return invoke("retrievePagedCustomers", searchKey, pageNo, DisplayConfiguration.getInstance().PAGE_SIZE);
		}
		
		public function getCustomerCount(searchKey:String = null):IInvokeResponder{
			return invoke("retrieveCustomerCount", searchKey);
		}	
		
		public function getCustomerBasicInfo(searchName:String=null):IInvokeResponder{
			return invoke("retrieveCustomerBasicInfo", searchName);
		}
		
	}
}